import java.util.Random;

/**
 * ������������HashCode������������
 * @author Administrator
 *
 */
public class HashMapTest {

	public static void main(String[] args) {
		String string = getString(1111111111);
		System.out.println(string.hashCode());
		System.out.println(string);
		System.out.println(" ".hashCode());
	}

	private static int getHash(String start) {

		int h = 0;
		char val[] = start.toCharArray();

		for (int i = 0; i < start.length(); i++) {
			h = 31 * h + val[i];
		}
		return h;
	}
	
	static Random r = new Random();
	
	
	private static String getString(int hashCode) {
		
		int temp = hashCode % 31;
		
		int t = r.nextInt(6);
		
		temp += t * 31;
		
		hashCode -= temp;
		
		hashCode /= 31;
		System.out.print((char)temp);
		if(hashCode < 250) {
			return (char) hashCode + "";
		} else {
			return getString(hashCode) + (char)temp;
		}
	}

	static String parse(String s) {
		return getZero(10 - s.length()) + s;
	}

	private static String getZero(int i) {
		switch (i) {
		case 1:
			return "0";
		case 2:
			return "00";
		case 3:
			return "000";
		case 4:
			return "000";
		case 5:
			return "0000";
		case 6:
			return "00000";
		case 7:
			return "000000";
		case 8:
			return "0000000";
		case 9:
			return "00000000";
		}
		return "000000000";
	}

}
